package com.yang.test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.demodis.domain.JsonO;
import com.demodis.domain.TblDetContent;

public class test02 {
	public static void main(String[] args) {
		/*Json json = new Json();
		json.setMsg("修改失败!");
		json.setSuccess(true);
		//String text = JSON.toJSONString(json);
		String text = "{\"msg\",\"success\"}";
		System.out.println(text);
		Object obj = JSON.parse(text);*/
		/*List<JsonO> list = new ArrayList<JsonO>();
		String str = "aaa,bbb,ccc,ddd";
		String[] strArr = str.split(",");
		for(String s : strArr) {
			JsonO json = new JsonO();
			json.name = s;
			json.value = 0;
			list.add(json);
		}
		
		System.out.println(JSON.toJSON(list));*/
		/*Map<String, String> map = new HashMap<String, String>();
		map.put("user", "sdfsdf");
		System.out.println(map.get("user"));
		System.out.println(map.get("sdkfj"));*/
		TblDetContent detCont = JSON.parseObject("{\"posId\":1,\"projectName\":\"职业道德\",\"detContent\":\"热爱本职工作，遵守劳动纪律，工作积极主动，敬业精神强\",\"detproOption\":\"dlfk\"}", TblDetContent.class);
		
		System.out.println(detCont.getDetproOption());
		//TblDetContent detCont = (TblDetContent) JSON.parse("{\"posId\":1,\"projectName\":\"职业道德\",\"detContent\":\"热爱本职工作，遵守劳动纪律，工作积极主动，敬业精神强\",\"detproOption\":\"dlfk\"}");
		
		
		//a();
	}
	
	public static void a() {
		String str = "[{\"value\":0},{\"name\":\"bbb\",\"value\":0},{\"name\":\"ccc\",\"value\":0},{\"name\":\"ddd\",\"value\":0}]";
		System.out.println(str);
		List<JsonO> list = JSON.parseArray(str, JsonO.class);
		for(JsonO json : list) {
			System.out.println(json.name);
			System.out.println(json.value);
		}
		
		TblDetContent detCont = (TblDetContent) JSON.parse("{\"posId\":1,\"projectName\":\"职业道德\",\"detContent\":\"热爱本职工作，遵守劳动纪律，工作积极主动，敬业精神强\",\"detproOption\":\"dlfk\"}");
		
	}
}
